package com.xd.core.api.vo;

import lombok.Data;
import sun.misc.BASE64Encoder;

import java.io.*;
import java.util.Base64;

@Data
//公证创建合同
public class NotarizationContractVo {
    private String contractNo;//合同编号
    private String contractUrl;//合同地址
    private String contractType;//合同类型
    private String contractName;//合同名称
    private String fileCode;//合同类型码

    public static void main(String[] args) throws IOException {
        File file = new File("D:\\壁纸\\tp\\101.jpg");;
        FileInputStream inputFile = new FileInputStream(file);
        byte[] buffer = new byte[(int) file.length()];
        inputFile.read(buffer);
        inputFile.close();
        String encode1 = Base64.getEncoder().encodeToString( buffer);
        String encode2 = new BASE64Encoder().encode(buffer);
        System.out.println(encode1);
        System.out.println(encode2);

        byte[] decode = Base64.getDecoder().decode(encode1);
        FileOutputStream out = new FileOutputStream("D:\\壁纸\\tp\\333.jpg");
        out.write(decode);
        out.close();

    }
}
